package com.cola.ui;

import com.cola.bean.User;
import com.cola.service.UserServers;
import com.cola.service.UserServiceImpl;
import com.cola.utils.BussinessException;

/**
 * @Grup:com.cola.ui
 * @Auther:cola
 * @Data:2021/4/16-2021-04-19:14
 * @version:1.0
 */
public class LoginClass extends BaseClass {
    public void login() throws BussinessException {
        println(getString("input.username"));
        String username=input.nextLine();
        println(getString("input.password"));
        String password=input.nextLine();
        UserServers userServers = new UserServiceImpl();
        User user = userServers.login(username, password);
        if (user!=null){
            curruser=user;
        }else {
            throw new BussinessException("login.error");
        }
    }
}
